home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!xmission!news
- From: tknarr@xmission.com ( Todd Knarr )
- Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3
- Subject: Re: Hungarian notation
- Date: 9 Jan 1996 01:57:49 GMT
- Organization: Chaos Central
- Message-ID: <4csi2t$gsa@news.xmission.com>
- References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <4crm6i$24mi@navajo.gate.net>
- Reply-To: tknarr@xmission.com ( Todd Knarr )
- NNTP-Posting-Host: slc31.xmission.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4crm6i$24mi@navajo.gate.net>, feathers@gate.net (Michael Feathers) writes:
- >I've never seen a variable that can be any of 9 different types in C++.
- >All variables have a type. Period. A type can be a union or a base
- >class, but all variables have one and only one type in C++. If you don't
- >believe me, check the ARM.
-
- You haven't worked with polymorphic classes as reference arguments or
- pointers much, then. I have the following class heirarchy:
-
- Stall
- AvailableStall
- AssignedStall
- OccupiedStall
- DirtyStall
- BeingCleanedStall
- BrokenStall
- OutOfServiceStall
- AlarmStall
- OfflineStall
-
- That's 9 subclasses of Stall. I do, though, routinely have arguments that
- are pointers or references to Stall. The actual object may be any one of
- those 9 subclasses.
-
- Give me an HN prefix that tells me that, in the following prototype
-
- Stall *HardwareChangeSignalled( Stall& ExistingStall, int ByteCount,
- unsigned char *aHardwareData );
-
- the ExistingStall argument is one of the 9 subclasses and never a Stall,
- and the returned pointer is one of the 9 subclasses and never a pointer to
- Stall.
-
- Without such a prefix, you can readily get the obnoxious situation of a new
- programmer depending on the prefix and not realizing that he is dealing with
- a polymorphic type. This can cause him problems if he refers to the source
- code for Stall, depending on the HN prefix to be the actual type.
-
- --
- Todd Knarr : tknarr@xmission.com | finger for PGP public key
- | Member, USENET Cabal
-
- Seriously, I don't want to die just yet. I don't care how
- good-looking they are, I! don't! want! to! die!"
- -- Megazone ( UF1 )
-
-